<?php 
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * 审核操作的日志
 * 
 * @desc    description
 * @version 1.0.0 
 * @author  Jason
 * @date    2017年6月19日 下午5:30:11
 */
class Mod_check extends MY_Model
{

	protected $table_mapper = [
			'master' => 'check_log',
	];
	
	public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	
	public function set_last($module, $resource, $status, $comment, $member_id)
	{
		$data['module'] = $module;
		$data['resource'] = $resource;
		$data['status'] = $status;
		$data['comment'] = $comment;
		$data['member_id'] = $member_id;
		$data['create_time'] = time();
		$this->db->insert($this->table_mapper['master'], $data);
		
		return ($this->db->affected_rows() > 0);
	}
	
	public function get_last($module, $resource)
	{
		$where = [
				'module' => $module,
				'resource' => $resource,
		];
		
		$query = $this->db->get_where($this->table_mapper['master'], $where);
		return $query->row_array();
	}
	
}